Skip to content

refactor(core): simplify packages/core — dead code, dedup, perf#1413

Merged
miguel-heygen merged 1 commit into
mainfrom
simplify/core-dead-code-sweep
Jun 13, 2026
Merged

refactor(core): simplify packages/core — dead code, dedup, perf#1413
miguel-heygen merged 1 commit into
mainfrom
simplify/core-dead-code-sweep

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Summary

Systematic simplification of packages/core/ across 6 focused commits:

  • Dead code sweep — delete unused mediaPreloader module (170 lines), 5 dead RuntimeState fields, unused emitPerformanceMetric, unexported lintScriptUrls, 5 unused variable type guards
  • Compiler dedup — unify REBASE_URL_RECSS_URL_RE, isRelativeUrlisNonRelativeUrl, collapse 3 MIME helpers into a map, reuse @import regex, delegate bulk rewriteAssetPaths to single-path helper
  • Lint cache + helpers — cache extractGsapWindows per script content (eliminates 2 redundant recast parses per lint run), move robust stripJsComments to shared utils (replaces weak inline regex in 2 rules), extract extractScriptTextsAndSrcs
  • Parser dedup — export serializeValue/safeJsKey from gsapSerialize, replace local duplicates in gsapParser; add locateAnimationWithFallback to centralize 6 inline converted-id retry blocks
  • Type consolidation — derive RuntimeBridgeControlAction from HyperframeControlAction, alias RuntimePickerElementInfo to HyperframePickerElementInfo
  • Perf quick wins — gate generateHyperframesStyles on includeStyles flag, merge 4 GSAP property mutation switch cases into 2

Net: -1019 lines across 22 files. All tests pass. No behavioral changes.

Test plan

  • bun run --cwd packages/core typecheck — passes
  • bun run --cwd packages/core test — 1427 tests pass (parser golden tests confirm identical output)
  • Pre-commit hooks pass (oxlint, oxfmt, fallow, typecheck, commitlint)

@miguel-heygen miguel-heygen force-pushed the simplify/core-dead-code-sweep branch 3 times, most recently from 079bcae to 08fc606 Compare June 13, 2026 21:14
- Delete unused mediaPreloader module, 5 dead RuntimeState fields,
  emitPerformanceMetric, lintScriptUrls, 5 variable type guards
- Consolidate compiler utilities: unify CSS URL regex, relative URL
  predicate, MIME map, @import regex, bulk asset rewrite delegation
- Cache extractGsapWindows per script (eliminates 2 redundant recast
  parses per lint run), share stripJsComments and script extraction
- Deduplicate GSAP parser: share serializeValue/safeJsKey, centralize
  converted-id fallback (6 sites), keyframe codegen (3 sites),
  waypoint extraction, insert-after-anchor, script hoisting
- Replace 88 bare any annotations with typed AstNode/AstPath interfaces
- Derive RuntimeBridgeControlAction from HyperframeControlAction,
  alias RuntimePickerElementInfo, share macOS font profiler
- Gate generateHyperframesStyles on includeStyles, collapse 4 GSAP
  property mutation cases into 2
- Extract magic numbers into named constants, replace 5 double casts
  with type guards and typed accessors (runtime/globals.ts),
  reduce function complexity in htmlParser and files route
@miguel-heygen miguel-heygen force-pushed the simplify/core-dead-code-sweep branch from 08fc606 to 127fdcb Compare June 13, 2026 21:37
@miguel-heygen miguel-heygen merged commit 6f67729 into main Jun 13, 2026
60 of 61 checks passed
@miguel-heygen miguel-heygen deleted the simplify/core-dead-code-sweep branch June 13, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant